home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / 4dostool / bkup10.zip / BKUP08.ZIP / BKUP08.BTM next >
Text File  |  1994-01-12  |  25KB  |  806 lines

  1. :  BKUP.BTM, version 8, January 1994
  2. :  (See also BKUP.DOC for detailed description, or see :HELP below,
  3. :   or type BKUP h ,or ?, [or i for syntax only].)
  4. :
  5. :  (1) Creates a ZIP archive for [a] all or part of the files saved today or
  6. :      [b] since a specified number of days back, or [c] since a specified
  7. :      date.
  8. :  (2) With the -x switch, extracts the ZIP archive(s). A selection menu
  9. :      will allow file selection, or aborting the operation (by ESC).
  10. :      For marking, use any of the SELECT keys (+, -, *, /, space).
  11. :  
  12. :  The user can specify (1) the drive to be searched (where new files
  13. :  were created), and (2) drive where the archive should be created. If
  14. :  no drives are specified, the default for searched drive is the default
  15. :  drive, and the deafult drive for creating the updates archive is B:.
  16. :  The same will apply for extraction of archives. The drive to be extracted
  17. :  from (where the archive is stored) will be drive B:, and the drive to
  18. :  extract to (that is, the drive to be updated) will be the default drive.
  19. :  If you wish to change any of these drives permanently, look for the
  20. :  '^^^' strings below and change there. If you just need to change the
  21. :  drives temporarily, use the command line options (see below, :help).
  22.  
  23. :  =====How BKUP.BTM proceeds=====
  24. :
  25. :  BKUP.BTM first creates a list of all the relevant files, then allows
  26. :  you to select one of the following options:
  27. :
  28. :  (*) Viewing (and handling) filenames on screen one by one
  29. :  (*) Use editor to edit results (results file)
  30. :  (*) View results before making any decision
  31. :  (*) Go immediately to archiving (no selection)
  32. :  (*) Quit (results file will remain intact)
  33. :
  34. :   If you choose viewing (and handling) files on screen, the following
  35. :   options are then available while working:
  36. :
  37. :  (*) Accept or omit a file
  38. :  (*) View a file before making a decision about it
  39. :  (*) Delete a file from disk (after or before viewing)
  40. :  (*) Stop selecting after a while and begin backing up (archiving)
  41. :  (*) View the list of selections at each item
  42. :  (*) Quit (results file will remain intact)
  43. :  
  44. :  When your decisions are done, this batch then
  45. :
  46. :  (*) Creates a MM-DD-YY.ZIP archive ('mm-dd-yy' stand for actual date)
  47. :      on drive B: (or change below to fit your needs).
  48. :                          OR
  49. :  (*) Updates MM-DD-YY.ZIP file, if it already exists, with the newly
  50. :      created list (this allows you every so often to backup files).
  51. :
  52. :  If the List file (the file with the list of filenames) exists (this
  53. :  batch leaves it intact), you are given the option to re-use it. This
  54. :  is very useful when you haven't created new files since your last backup,
  55. :  only worked on your previously created files.
  56. :
  57. :  Note: ===> If you need backup for a number of days back, run this batch
  58. :  with n, as indicated below.
  59. :
  60. : When extraction takes place (with switch -x),
  61. :
  62. :  (*) A selection menu will allow file selection, or aborting the
  63. :      operation (by ESC). For marking, use any of the SELECT keys
  64. :      (+, -, *, /, space).
  65. :  (*) The extracted file is marked by a 4DOS description. If you have
  66. :      given your computer a "name", BKUP registers this name in the file
  67. :      description upon completion of extraction. It will then stop you if
  68. :      you try to extract it again to the same computer, asking you if you
  69. :      wish to proceed, or go right to extraction if it's a different
  70. :      computer. If the computer has no "name", it will always ask you if you
  71. :      wish to extract even if it's the wrong computer. You can then "force
  72. :      extract" it. If the updated files happen to already exist on the disk,
  73. :      they will not be extracted anyway (even of you "force extract").
  74.  
  75. :      See BKUP.DOC or type BKUP /h for explanations about naming a
  76. :      computer, or just run BKUP and follow the questions.
  77. :
  78. :      Each time the archive is updated, it will then be marked as such,
  79. :      allowing subsequent extractions again.
  80. :
  81. : =====Customizing=====
  82. :      You can change any of the parameters where '^^^' strings appear.
  83. :
  84. : =====PCTODAY.EXE=====
  85. :      Note: This batch needs PCTODAY.EXE (c) by Ethan Winer.
  86. :      (downloadable from SIMTEL20: <msdos.pcmag>VOL10N21.ZIP)
  87. :
  88. :  Initiated by Ron Zweig (ron@ccsg.tau.ac.il).
  89. :  Edited and augmented by Itamar Even-Zohar (itiez@ccsg.tau.ac.il).
  90. :
  91. :  Version 7, November 1993: Fuller filename display and computer "name"
  92. :  added for better information about which computer has been updated.
  93. :  Version 8, January 1994: (1) A safer procedure for defining a temporary
  94. :  drive added; (2) A better file selection menu replace the one-at-time
  95. :  selection menu (thanks due to Sam Wilson; see label ":operate" for
  96. :  details).
  97. :: ------------------------------------------------------------------
  98. :  The actual batch begins here
  99. :: ------------------------------------------------------------------
  100. :pctoday?
  101. rem     Finds out if PCTODAY.EXE is found on your path.
  102. iff "%@search[pctoday.exe]" =="" then
  103. beep
  104. text
  105.  
  106.    This batch needs PCTODAY.EXE (c) by Ethan Winer
  107.    (downloadable from SIMTEL20: <msdos.pcmag>VOL10N21.ZIP)
  108. endtext
  109. quit
  110. endiff
  111.  
  112. iff %@index[%1,h] ge 0 .or. %@index[%1,?] ge 0 then
  113.   goto help
  114. elseiff %@index[%1,i] ge 0 then
  115.   goto help_i
  116. endiff
  117.  
  118. :compu_name
  119. if "%compuname"=="" gosub compuname
  120.  
  121. setlocal
  122.  
  123. :set_temp
  124. if "%temp"=="" gosub setramd
  125. : (temporary drive will be defined %_lastdisk if it is not remote
  126. :  or cd-rom drive.)
  127. if not direxist %temp (set temp=^gosub setramd)
  128. iff "%@substr[%temp,0,-1]" == "\" then
  129. set temp=%temp%
  130.  else
  131. set temp=%temp\
  132. endiff
  133.  
  134. iff %@index[%1,x] ge 0 then
  135.   goto extract_f
  136. endiff
  137.  
  138. gosub check_args
  139.  
  140. iff %@index[%1,/s] ge 0 .or. %@index[%1,-s] ge 0 then
  141.    set zz=%@substr[%1,2]
  142.    goto _date2
  143. elseiff %@index[%1,s] eq 0 then
  144.    set zz=%@substr[%1,1]
  145.    goto _date2
  146. else
  147.    goto _date1
  148. endiff
  149.  
  150. :set_defaults
  151.   :_date1
  152. set xx=%@date[%_date]
  153. :      This is today'y date in full numbers since 1-1-1980
  154. set zz=%@makedate[%@eval[%xx-%1]]
  155. :      This is the actual date desired for the archive file.
  156. :      If no number of days indicated by user, you get today's
  157. :      date again.
  158. if %@index[%zz,0] eq 0 set zz=%@substr[%zz,1]
  159. :      If a zero (0) is contained on the first position (01, etc.),
  160. :      it will be removed.
  161.   :_date2
  162. set rsp=%temp%updates.rsp
  163. set zipfn=%temp%updates.zip
  164. set tmpf=%@unique[%temp]
  165. if exist %zipfn del /q %zipfn
  166. rem  (This is just a precaution; this file is moved anyway, if batch
  167. rem  terminates in a normal way.)
  168.  
  169. :modifiables
  170. rem  ==> Modify any of the following variables to your preference.
  171. set exclude=-x*.tmp -x*.00? -x*.bak -xpctoday.* -x*.zip -xkermit.*
  172. rem         (filepatterns excluded from updating)
  173. set dr=%archive_drive
  174.     iff %@index[%dr,:] eq 1 then
  175.         set dr=%@substr[%dr,1,-1]
  176.     endiff
  177. rem    ('archive_drive' was determined by the 'checking drives' subroutines.
  178. rem    This is the drive for the final ZIP archive; the temporary file will
  179. rem    be created on your 'temp' drive, if it exists, else on deafult
  180. rem    drive.)
  181. set pkz=pkzip -P -ex
  182. rem    (archiving with pathnames; erase '-P' if no pathnames desired)
  183. set colordir=dirs:bright white;zip:black on white;
  184. set edt=ped.exe
  185. rem     ^^^^^^^ (replace ped.exe by your preferred editor)
  186.  
  187. :re-use?
  188. cls
  189. if exist %rsp goto ask
  190. goto accumulate
  191.  
  192. :ask
  193. echo.
  194. gosub legenda
  195. screen 2 0
  196. inkey /K"YNVESQ" Use extant list file? (created %@filedate[%rsp], at %@filetime[%rsp])? [time now: %_time]n (List File is: %@upper[%rsp])nnType Y/N, V(iew), S(creen), E(dit), or Q(uit) %%rep
  197.     iff %rep == Q then cls^screen 2 0^set ech=echo Stopped by user^ goto end
  198. elseiff %rep == Y then goto backup
  199. elseiff %rep == V then *list %rsp^cls^goto ask
  200. elseiff %rep == E then %edt %rsp^goto backup
  201. elseiff %rep == S then echo. >%tmpf^cls^set num=0^goto edit
  202. elseiff %rep == N goto accumulate
  203. endiff
  204.  
  205. :accumulate
  206. cls
  207.   iff %_monitor == mono then
  208. screen 4 5 [ making a list of all new files created since %zz ]
  209. screen 3 5 Working ...
  210.   else
  211. scrput 4 5 gre on whi